home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 3 / Info_Mac_1994-01.iso / Development / Source / MultiSession 1.04 Source / Core 27⁄June⁄1993 / Debug.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-04-02  |  1.9 KB  |  47 lines  |  [TEXT/KAHL]

  1. /* Debug.h */
  2.  
  3. #pragma once
  4.  
  5. /* error handling utilities */
  6.  
  7. /* in order to use this debugging package, define the following macros */
  8. /* in the prefix: */
  9. /* #define DEBUG  defines the EXECUTE and ERROR macros */
  10. /* #define ALWAYSRESUME  makes the 'resume' button always available, even */
  11. /*  if 'ForceAbort' was passed to PRERR */
  12. /* #define THINKC_DEBUGGER  adds two breakpoints to the PRERR function, one */
  13. /*  just before it calls ExitToShell() for 'Quit' button, the other just before */
  14. /*  the function returns to caller for 'Resume' button. */
  15.  
  16. #define ForceAbort (0)
  17. #define AllowResume (1)
  18.  
  19. pascal void        MyResumeProc(void);
  20. void        PRERR(short AbortFlag, void* Message);
  21. void        InitPRERR(void);
  22. void        SetErrorFunction(void (*Erf)(void));
  23.  
  24. /* debugging macros */
  25. #ifdef DEBUG
  26.     /* EXECUTE(function) executes the function */
  27.     /* in a code block, it can be called like a function:  EXECUTE(parameter); */
  28.     /* in declarations, the semi-colon must be included as part of the parameter: */
  29.     /*  EXECUTE(parameter;) */
  30.     #define EXECUTE(function)  function
  31.     /* ERROR(condition,function) executes the function if condition is TRUE */
  32.     /* there is no reason to call this anywhere other than a code block */
  33.     #define ERROR(condition,function)  if (condition) EXECUTE(function)
  34.     /* checks the range of access of a handle to see if it is within the handle's size */
  35.     /* AccessSize is how large an 'object' will be accessed.  Pass sizeof(type) to it. */
  36.     void            HRNGCHK(void* TheHandle, void* EffectiveAddress, signed long AccessSize);
  37.     /* checks the range of access of a ptr to see if it is within the ptr's size */
  38.     /* AccessSize is how large an 'object' will be accessed.  Pass sizeof(type) to it. */
  39.     void            PRNGCHK(void* ThePointer, void* EffectiveAddress, signed long AccessSize);
  40. #else
  41.     /* these versions ignore their parameters and generate no code */
  42.     #define EXECUTE(function)
  43.     #define ERROR(condition,param)
  44.     #define HRNGCHK(Hand,Addr,Mode)
  45.     #define PRNGCHK(Poin,Addr,Mode)
  46. #endif
  47.